/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package classcreator;

import java.io.BufferedWriter;
import java.io.IOException;

/**
 *
 * @author Stefano
 */
public enum Visibility {
    priv,
    prot,
    pack,
    publ;
    @Override
    public String toString(){
        if(this==priv) return "private";
        if(this==prot) return "protected";
        if(this==pack) return "package";
        else return "public";
    }
    public static Visibility parse(String s){
        if(s.equals("private")) return priv;
        if(s.equals("protected")) return prot;
        if(s.equals("package")) return pack;
        else return publ;
    }
    public static Visibility get(int i){
        switch(i){
            case 0: return priv;
            case 1: return prot;
            case 2: return pack;
            case 3: return publ;
            default: return priv;
        }
    }
    
    public void permanentize(BufferedWriter br, TypeRepository tr) throws IOException{
                br.write(this.toString()); br.newLine();
    }
}
